<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Home extends CI_Controller {
	var $title; 
	var $salt;
	var $member_type=false;
	var $member_data=array();
	var $member=array();
	
	public function __construct()
	{
		parent::__construct();
		
		$this->member[0]='student';
		$this->member[1]='teacher';
		$this->member[2]='educator';
		$this->member[3]='parent';
		$this->member[4]='institute';
		
		#load all database and required models
		$this->load->database();
		$this->load->model('common_model');
		
		#check authentication
		/*if ($this->common_model->is_user_logged_in()) 
		{
		   if ($this->session->flashdata('flash_message')) {$this->session->keep_flashdata('flash_message'); }
		   $member_type=$this->common_model->is_user_logged_in();
		   //redirect(base_url().BASE."{$member_type}/dashboard");
		   redirect(base_url().BASE."dashboard");
		   exit;
		}*/
		#set variable
		if($this->session->userdata('member_type'))
		{
		  $this->member_type=$this->session->userdata('member_type');
		  $this->data['member_type']=$this->member;
		}
		if($this->session->userdata('member_data'))
		{
		   $this->member_data=$this->session->userdata('member_data');
		}
		if($this->session->userdata('input_data'))
		{
		    $this->data['input_data']=$this->session->userdata('input_data');
		}
		
		if($this->session->userdata('member_detail_data'))
		{
		    $this->data['member_detail_data']=$this->session->userdata('member_detail_data');
		}
		if($this->session->userdata('is_member_join'))
		{
		    $this->data['is_member_join']=$this->session->userdata('is_member_join');
		}
		
		#common setting 
		$config['salt']=$this->common_model->salt();
		$config['separator']=$this->common_model->title_separator();
		$config['title']=$this->common_model->base_title();
		$config['short_title']=$this->common_model->short_title();
	    $this->data['config_data']=$config;
		$this->title=$this->common_model->base_title().' '.$this->common_model->title_separator().' ';
		$this->salt=$this->common_model->salt();
		#######
		$this->data['type']=$this->member;
	    $this->data['javscript_error']=$this->lang->line('javscript_error');
		$this->data['label']=$this->lang->line('php_label');
		$this->data['page']=$this->lang->line('page');
		$this->data['static_info']=$this->lang->line('static_info');
		$this->data['gender']=$this->lang->line('gender');
		$this->data['header']=$this->lang->line('header');
		$this->data['footer']=$this->lang->line('footer');
		$this->data['static_text']=$this->lang->line('static_text');
	}

	public function index()
	{
		$this->data['title'] =$this->title.$this->data['page']['home']['title'];
		$this->data['flash_message'] = $this->session->flashdata('flash_message');	
		$this->load->view('index', $this->data);
		//$this->delete_session_data();
	}

	public function join_in()
    {	
	    $this->delete_session_data();
		// If 'Login' form has been submited, attempt to log the member in.
		$this->data['title'] =$this->title.$this->data['page']['join_in']['title'];
		if ($this->input->post())
		{
			if($this->input->post('category')=='join_in')
			{
				// Set validation rules.
				$this->form_validation->set_rules('email',$this->data['label']['email'],'trim|required|valid_email');
				$this->form_validation->set_rules('password', $this->data['label']['password'],'trim|required');
				// Run the validation.
				if ($this->form_validation->run())
				{
					$remember_user = ($this->input->post('remember_me') == 1);
					$login_deails['email']=$this->input->post('email');
					$login_deails['password']=md5($this->input->post('password'));	
                    					
					if(!$this->common_model->verify_email($this->input->post('email')))
					{
					    $member_identity=$this->input->post('email');
						$email_line=$this->lang->line('email_not_found');
						$email_not_found=sprintf("$email_line",$member_identity );
						$this->data['error']=$email_not_found;
						$this->load->view('join_in',$this->data);
					//var_dump($this->data['error']); die;	
					}
					elseif(!$this->common_model->is_active($this->input->post('email')))
					{
						$this->data['error']=$this->lang->line('account_requires_activation');
						$this->load->view('join_in',$this->data);
					}
					elseif(!$this->common_model->join_in($login_deails, $remember_user))
					{
						$this->data['error']=$this->lang->line('login_unsuccessful');
						$this->load->view('join_in',$this->data);
					}
					else
					{
						redirect(BASE_URL.'study');
						exit();
				
					}
				}
				else
				{
					$this->data['error'] = validation_errors();
					$this->load->view('join_in', $this->data);
				}
			}
			if($this->input->post('category')=='join_as')
			{
				$this->form_validation->set_rules('email',$this->data['label']['email'],'trim|valid_email');
				$this->form_validation->set_rules('password', $this->data['label']['password'],'trim');
				if ($this->form_validation->run())
				{
					$this->session->set_userdata('user_email',$this->input->post('email'));
					$this->data['input_data'] = $this->input->post();
					$this->session->set_userdata('join_in', $this->data['input_data']);
					$this->load->view('join_as',$this->data);
					//var_dump($this->session->userdata('join_in')); die;		
				}
					else
					{
					$this->data['error']=$this->lang->line('login_unsuccessful');
					$this->session->set_userdata('invalid_login', $this->data['error']);
					redirect(BASE_URL.'join_in');
					}
			}
		}
		else{
			$this->data['flash_message'] = $this->session->flashdata('flash_message');		
			$this->load->view('join_in', $this->data);
		}
    }

	public function member()
	{
		$this->data['title'] =$this->title.$this->data['page']['join_as']['title'];
		$this->config->set_item('sess_expire_on_close', FALSE); //'remember' is checkbox name.
		$this->load->view('member', $this->data);
	}
	
	public function forgot()
	{
	//
	    $this->data['title'] =$this->title.$this->data['page']['forgot_password']['title'];
		if ($this->input->post())
		{
			if($this->input->post('category')=='join_in')
			{
				redirect('home/join_in');
				die;
		    }
			if($this->input->post('category')=='join_as')
			{
				redirect('home/join_as');
				die;
		    }
			if($this->input->post('category')=='forgot')
			{
			$this->load->view('forgot_password');
			die;
			}
			//var_dump($this->input->post()); die;
			$this->form_validation->set_rules('email', $this->data['label']['email'], 'trim|required|valid_email');
			$this->form_validation->set_message('required', $this->lang->line('required'));
			$this->form_validation->set_message('valid_email', $this->lang->line('email_invalid'));
			// Run the validation.
			if ($this->form_validation->run())
			{
				$member_identity = $this->input->post('email');
				//$this->load->model('home_model');
				if(!$this->common_model->verify_email($member_identity))
				{
					$email_line=$this->lang->line('email_not_found');
					$error_res=sprintf("$email_line",$member_identity);
					$this->data['error']='<div class="error"><samp class="big-error">*</samp>'.$error_res.'</div>';
					$this->session->set_userdata('invalid_login', $error_res);
					redirect(BASE_URL.'forgot_password');
				}
				elseif($this->common_model->is_active($member_identity) == FALSE)
				{
					$this->session->set_flashdata('error', $this->lang->line('account_requires_activation'));
					$this->session->set_userdata('invalid_login', 'You need to activate your Email Account ');
					redirect(BASE_URL.'forgot_password');
				}
				else
				{
                                    $this->common_model->sent_forgot_email($member_identity);
                                    $this->session->set_userdata('invalid_login', 'Activation link sent to your EmailID '); 
                                    redirect(BASE_URL.'forgot_password');
					
					//$this->session->set_flashdata('flash_message', $this->lang->line('email_forgot_password_successful'));
					//redirect('home/message');
				}
			}
			else
			{	
				// Set validation errors.
				$this->data['error'] = validation_errors('<div class="error"><samp class="big-error">*</samp>', '</div>');
			}
		}
		$this->data['flash_message'] = $this->session->flashdata('flash_message');
		$this->load->view('forgot_password', $this->data);
		
	}

	public function join_as()
	{
	
		   $this->delete_session_data();
		   $this->data['title'] =$this->title.$this->data['page']['join_as']['title'];
		   $this->config->set_item('sess_expire_on_close', FALSE); //'remember' is checkbox name.

		   $this->load->view('join_as',$this->data);
			
	}

	public function join_as_member($type)
	{
		if(isset($type) && $type != '')
		{
			$member_type=$type;
		}
		
		if($this->session->userdata('member_type'))
		{
		$this->session->set_userdata('member_type',$member_type);
			
		}
		
		if(!$member_type || !in_array($member_type, $this->member))
		{
			$this->session->set_flashdata($this->lang->line('invalid_member_type_choose'));
			redirect(base_url().BASE.'join_as');
			die;
		}
		$page_as = 'join_as_'.$member_type;
		$this->data['title'] =$this->title.$this->data['page'][$page_as]['title'];
		$this->data['h1_title'] = $this->data['page'][$page_as]['title'];
		$this->data['class_list'] =$this->common_model->class_list();
		$this->data['member_type']=$member_type;
		//$this->data['member_data_input'] = $this->session->userdata('member_data');
		//$this->session->unset_userdata('member_data');
			//var_dump($this->data['member_type']);die();
		$this->data['flash_message'] = $this->session->flashdata('flash_message');
		$this->load->view('join_as_member',$this->data);
	}
	
	public function join_as_submit()
	{ 
		if($this->input->post('member_type') == 'student'){
			$this->form_validation->set_rules('first_name', $this->data['label']['first_name'], 'trim|required|xss_clean|alpha_dash');
			$this->form_validation->set_rules('last_name', $this->data['label']['last_name'], 'trim|required|xss_clean|alpha_dash');
			$this->form_validation->set_rules('gender', $this->data['label']['gender'], 'trim|required|xss_clean');
			$this->form_validation->set_rules('class', $this->data['label']['class'], 'trim|required|xss_clean');
			$this->form_validation->set_rules('section', $this->data['label']['section'], 'trim|required|xss_clean|alpha_dash');
			$this->form_validation->set_rules('school', $this->data['label']['school'], 'trim|required|xss_clean|alpha_dash');
			$this->form_validation->set_rules('board', $this->data['label']['board'], 'trim|required|xss_clean|alpha_dash');
			// Run the validation.
				if ($this->form_validation->run())
				{
						//var_dump('pass'); die();
						$this->data['input_data'] = $this->input->post();
						$this->session->set_userdata('member_data', $this->data['input_data']);
						//var_dump($this->session->userdata('member_data')); die();
					    redirect(base_url().BASE.'join_as_student_continue');
						exit();
					  //  die;
				}
				else
				{
					//var_dump('fail');die();
					$this->data['input_data'] = $this->input->post();
					$this->data['member_type'] = $this->input->post('member_type');
					$this->data['error'] = validation_errors('<div class="error"><samp class="big-error">*</samp>', '</div>');
					$this->session->set_userdata('invalid_login','Please enter the details correctly');
					redirect(BASE_URL.'join_as_student');
					//var_dump($this->data['error']);die();
					//$this->load->view('join_as_member',$this->data);
				}
		}
		
		if($this->input->post('member_type') == 'teacher'){
			$this->form_validation->set_rules('first_name', $this->data['label']['first_name'], 'trim|required|alpha_dash');
			$this->form_validation->set_rules('last_name', $this->data['label']['last_name'], 'trim|required|alpha_dash');
			$this->form_validation->set_rules('gender', $this->data['label']['gender'], 'trim|required|alpha_dash');
			$this->form_validation->set_rules('class', $this->data['label']['class'], 'trim|required');
			$this->form_validation->set_rules('subject', $this->data['label']['subject'], 'trim|required|alpha_dash');
			$this->form_validation->set_rules('school', $this->data['label']['school'], 'trim|required|alpha_dash');
			$this->form_validation->set_rules('board', $this->data['label']['board'], 'trim|required|alpha_dash');
			// Run the validation.
				if ($this->form_validation->run())
				{
						$this->data['input_data'] = $this->input->post();
						$this->session->set_userdata('member_data', $this->data['input_data']);
						//var_dump($this->session->userdata('member_data')); die();
					    redirect(base_url().BASE.'join_as_teacher_continue');
					    die;
				}
				else
				{
					$this->data['input_data'] = $this->input->post();
					$this->data['member_type'] = $this->input->post('member_type');
					$this->data['error'] = validation_errors('<div class="error"><samp class="big-error">*</samp>', '</div>');
					$this->session->set_userdata('invalid_login','Please enter the details correctly');
					redirect(BASE_URL.'join_as_teacher');
					//$this->load->view('join_as_member',$this->data);
				}
		}
		
		if($this->input->post('member_type') == 'educator'){
			$this->form_validation->set_rules('first_name', $this->data['label']['first_name'], 'trim|required|alpha_dash');
			$this->form_validation->set_rules('last_name', $this->data['label']['last_name'], 'trim|required|alpha_dash');
			$this->form_validation->set_rules('gender', $this->data['label']['gender'], 'trim|required');
			$this->form_validation->set_rules('class', $this->data['label']['class'], 'trim|required');
			$this->form_validation->set_rules('subject', $this->data['label']['subject'], 'trim|required|alpha_dash');
			$this->form_validation->set_rules('board', $this->data['label']['board'], 'trim|required|alpha_dash');
			$this->form_validation->set_rules('city', $this->data['label']['city'], 'trim|required|alpha_dash');
			$this->form_validation->set_rules('state', $this->data['label']['state'], 'trim|required|alpha_dash');
			// Run the validation.
				if ($this->form_validation->run())
				{
						$this->data['input_data'] = $this->input->post();
						$this->session->set_userdata('member_data', $this->data['input_data']);
					    redirect(base_url().BASE.'join_as_educator_continue');
					    die;
				}
				else
				{
					$this->data['input_data'] = $this->input->post();
					$this->data['member_type'] = $this->input->post('member_type');
					$this->data['error'] = validation_errors('<div class="error"><samp class="big-error">*</samp>', '</div>');
					$this->session->set_userdata('invalid_login','Please enter the details correctly');
					redirect(BASE_URL.'join_as_educator');
					//$this->load->view('join_as_member',$this->data);
				}
		}

		if($this->input->post('member_type') == 'parent'){
			$this->form_validation->set_rules('first_name', $this->data['label']['first_name'], 'trim|required|alpha_dash');
			$this->form_validation->set_rules('last_name', $this->data['label']['last_name'], 'trim|required|alpha_dash');
			$this->form_validation->set_rules('gender', $this->data['label']['gender'], 'trim|required');
			$this->form_validation->set_rules('class', $this->data['label']['class'], 'trim|required');
			$this->form_validation->set_rules('school', $this->data['label']['school'], 'trim|required|alpha_dash');
			$this->form_validation->set_rules('board', $this->data['label']['board'], 'trim|required|alpha_dash');
			// Run the validation.
				if ($this->form_validation->run())
				{
						$this->data['input_data'] = $this->input->post();
						$this->session->set_userdata('member_data', $this->data['input_data']);
						//var_dump($this->session->userdata('join_in')); die;
					    redirect(base_url().BASE.'join_as_parent_continue');
					    die;
				}
				else
				{
					$this->data['input_data'] = $this->input->post();
					$this->data['member_type'] = $this->input->post('member_type');
					$this->data['error'] = validation_errors('<div class="error"><samp class="big-error">*</samp>', '</div>');
					$this->session->set_userdata('invalid_login','Please enter the details correctly');
					redirect(BASE_URL.'join_as_parent');
					//$this->load->view('join_as_member',$this->data);
				}
		}
		
		if($this->input->post('member_type') == 'institute'){
			$this->form_validation->set_rules('institute', $this->data['label']['ints_name'], 'trim|required|alpha_dash');
			$this->form_validation->set_rules('city', $this->data['label']['city'], 'trim|required|alpha_dash');
			$this->form_validation->set_rules('state', $this->data['label']['state'], 'trim|required|alpha_dash');
			$this->form_validation->set_rules('email', $this->data['label']['ints_email'], 'trim|required|valid_email');
			$this->form_validation->set_rules('category', $this->data['label']['ints_type'], 'trim|required');
			$this->form_validation->set_rules('phone', $this->data['label']['phone'], 'trim|numeric');
			// Run the validation.
				if ($this->form_validation->run())
				{
						$this->data['input_data'] = $this->input->post();
						$this->session->set_userdata('member_data', $this->data['input_data']);
						$this->session->set_userdata('member_type',$this->input->post('member_type'));
						//var_dump($this->session->userdata('join_in')); die;
					    redirect(base_url().BASE.'join_as_institute_continue');
					    die;
				}
				else
				{
					$this->data['input_data'] = $this->input->post();
					$this->data['member_type'] = $this->input->post('member_type');
					$this->data['error'] = validation_errors('<div class="error"><samp class="big-error">*</samp>', '</div>');
					$this->session->set_userdata('invalid_login','Please enter the details correctly');
					redirect(BASE_URL.'join_as_institute');
					//$this->load->view('join_as_member',$this->data);
				}
		}
		
		if(!in_array($this->input->post('member_type'), $this->member))
		{
			redirect(base_url().BASE.'join_as');
		}
	}

	public function join_as_submit_continue($type)
	{
		$member_type=$type;
		if(!$this->session->userdata('member_data'))
		{
			redirect(base_url().BASE.'join_as_'.$member_type);
		}

		if(!$member_type || !in_array($member_type, $this->member))
		{
			$this->session->set_flashdata($this->lang->line('invalid_member_type_choose'));
			redirect(base_url().BASE.'join_as');
			die;
		}
		$page_as = 'join_as_'.$member_type;
		$this->data['title'] =$this->title.$this->data['page'][$page_as]['title'];
		$this->data['h1_title'] = $this->data['page'][$page_as]['title'];
		$this->data['member_type']=$member_type;
		$this->data['input_data'] = $this->session->userdata('member_data');
			
		$this->data['error'] = $this->session->flashdata('flash_message');
		$this->load->view('join_as_member_continue',$this->data);
	}
	
	public function join_as_final_submit($type=NULL)
	{
		if($this->session->userdata('member_type') && $this->session->userdata('member_type') != '')
		{
			$member_type = $this->session->userdata('member_type');
		}
		else {
			$member_type = $type;
		}
		
		if($this->input->post('email') != '')
		{
			$this->form_validation->set_rules('email', $this->data['label']['email'], 'trim|required|valid_email|xss_clean');
			$this->form_validation->set_rules('password', $this->data['label']['password'], 'trim|required|matches[reconfirming_password]');
			$this->form_validation->set_rules('reconfirming_password', $this->data['label']['reconfirming_password'], 'trim|required');
			// Run the validation.
			if ($this->form_validation->run())
			{
				$search = trim($this->input->post('email'));
				$email_check = $this->common_model->check_email1($search);
				$email_check = $email_check->num_rows();
				if($email_check > 0)
				{
					$this->session->set_userdata('invalid_email','This email address already exist');
					redirect(BASE_URL.'join_as_'.$member_type.'_continue');
				}
				else
				{
			    //var_dump($member_type); die;
				$page_as = 'join_as_'.$member_type;
				$this->data['title'] =$this->title.$this->data['page'][$page_as]['title'];
				$this->data['h1_title'] = $this->data['page'][$page_as]['title'];
				$this->data['input_data'] = $this->input->post();
				$this->data['post_data'] = null;
				$this->data['post_data'] = $this->session->userdata('new_data');
				$this->data['post_data'] = $this->data['post_data'] + $this->data['input_data'];
				//var_dump($this->data['post_data']);die();
				$this->data['post_reply'] = $this->common_model->join_as($this->data['post_data']);
				if($this->data['post_reply'])
				{
					$this->data['post_message'] = $this->lang->line('activation_email_successful');
				}
				else 
				{
					$this->data['post_message'] = $this->lang->line('account_creation_unsuccessful');
				}
				$this->delete_session_data();
				$this->load->view('join_as_member_message',$this->data);
			}
			}
			else
			{
				$this->data['input_data'] = $this->input->post();
				$this->data['error'] = validation_errors('<div class="error"><samp class="big-error">*</samp>', '</div>');
				$this->load->view('join_as_member_continue',$this->data);
			}
		}
		else
		{
			redirect(base_url().BASE.'join_as_'.$member_type);
		}
		
	}
	
	public function redirect_member($type)
	{
		$member_type = $type;
                $member_type = $this->security->xss_clean($member_type);
                $this->data['member_type'] = $member_type;
                if(!$member_type || !in_array($member_type, $this->member))
		{
			$this->session->set_flashdata($this->lang->line('invalid_member_type_choose'));
			redirect(base_url().BASE.'join_as');
			die;
		}
                else if($this->input->post())
                {
                    $post_data = $this->security->xss_clean($this->input->post());
                    $post_keys = array_keys($post_data);
                    $a_count = count(array_keys($post_data));
                    for($i=0;$i<=$a_count-1;$i++)
                    {
                        $this->form_validation->set_rules($post_keys[$i],$post_keys[$i], 'trim|xss_clean');
                    }
                    if ($this->form_validation->run())
                    {
                        $this->session->set_userdata('member_data',$this->security->xss_clean($this->input->post()));
                        redirect(base_url().BASE.'join_as_'.$member_type.'_detail');
                        exit();
                    }
                    else
                    {
                        $this->data['member_data_input'] = $this->security->xss_clean($this->input->post());
                        $this->data['error'] = validation_errors();
			$this->load->view('join_as_member', $this->data);
                    }
                }
	}
	
	public function join_as_member_detail($type)
	{
		$member_type=$type;
		if(!$member_type || !in_array($member_type, $this->member))
		{
			$this->session->set_flashdata($this->lang->line('invalid_member_type_choose'));
			redirect(base_url().BASE.'join_as');
			die;
		}
		$page_as = 'join_as_'.$member_type;
		$this->data['title'] =$this->title.$this->data['page'][$page_as]['title'];
		$this->data['h1_title'] = $this->data['page'][$page_as]['title'];
		$this->data['class_list'] =$this->common_model->class_list();
		$this->data['member_type']=$member_type;
		$this->data['input_data'] = $this->security->xss_clean($this->session->userdata('member_data'));
                $this->data['input_data']['next'] = 'active';
                
		$this->data['flash_message'] = $this->session->flashdata('flash_message');
		$this->load->view('join_as_member_detail',$this->data);
	}
	
	public function join_as_submit_detail_continue()
	{
	$member_type=$this->input->post('member_type');
	
		if(!$this->input->post())
		{
			redirect(base_url().BASE.'join_as_'.$member_type.'_detail');
		}

		if(!$member_type || !in_array($member_type, $this->member))
		{
			$this->session->set_flashdata($this->lang->line('invalid_member_type_choose'));
			redirect(base_url().BASE.'join_as');
			die;
		}
		$page_as = 'join_as_'.$member_type;
		$this->data['title'] =$this->title.$this->data['page'][$page_as]['title'];
		$this->data['h1_title'] = $this->data['page'][$page_as]['title'];
		$this->data['class_list'] =$this->common_model->class_list();
		$this->data['member_type']=$member_type;
		if($member_type == 'student'){
			if($this->input->post('part') == 'personal')
			{
				$this->form_validation->set_rules('email', $this->data['label']['email'], 'trim|required|valid_email|is_unique[zrc_members.email]');
				$this->form_validation->set_rules('password', $this->data['label']['password'], 'trim|required');
				$this->form_validation->set_message('is_unique', 'You are already registered');
				// Run the validation.
					if ($this->form_validation->run())
					{
						$this->session->set_userdata('member_data', $this->input->post());
						$this->session->set_userdata('member_email', $this->input->post('email'));
						$this->data['input_data'] = $this->session->userdata('member_data');
						$insert = $this->common_model->join_as_detail($this->data['input_data']);
						$this->session->set_userdata('insert_id', $insert);
						$this->data['insert_id'] = $this->session->userdata('insert_id');
						if(isset($insert) && $insert != '' && $this->input->post('email'))
						{
							$this->data['next'] = 'academic';					
						}
						else 
						{
							$this->data['next'] = 'personal';
						}
						$this->session->set_userdata('submit', 'hide');
						$this->load->view('join_as_member_detail',$this->data);
					}
					else
					{
						$this->data['input_data'] = $this->input->post();
						$this->data['error'] = validation_errors('<div class="error"><samp class="big-error">*</samp>', '</div>');
						$this->load->view('join_as_member_detail',$this->data);
					}
			}
			if($this->input->post('part') == 'academic_school')
			{
				$this->form_validation->set_rules('school', $this->data['label']['school'], 'trim|required');
				$this->form_validation->set_rules('class', $this->data['label']['class'], 'trim|required');
				// Run the validation.
					if ($this->form_validation->run())
					{
						$this->session->set_userdata('member_data', $this->input->post());
						$this->data['post_data'] = $this->session->userdata('member_data');
						$this->data['post_data']['member_id'] = $this->session->userdata('insert_id');
						$insert = $this->common_model->join_as_detail($this->data['post_data']);
						$this->session->set_userdata('school_insert_id', $insert);
						$this->data['school_insert_id'] = $this->session->userdata('school_insert_id');
						if(isset($insert) && $insert != '' && $this->input->post('school'))
						{
							$this->data['next'] = 'professional';					
						}
						else 
						{
							$this->data['next'] = 'academic';
						}
						$this->load->view('join_as_member_detail',$this->data);
					}
					else
					{
						$this->data['input_data'] = $this->input->post();
						$this->data['error'] = validation_errors('<div class="error"><samp class="big-error">*</samp>', '</div>');
						$this->load->view('join_as_member_detail',$this->data);
					}
			}
			if($this->input->post('part') == 'academic_college')
			{
				$this->form_validation->set_rules('college', $this->data['label']['college'], 'trim|required');
				$this->form_validation->set_rules('course_name', $this->data['label']['course_name'], 'trim|required');
				// Run the validation.
					if ($this->form_validation->run())
					{
						$this->session->set_userdata('member_data', $this->input->post());
						$this->data['post_data'] = $this->session->userdata('member_data');
						$this->data['post_data']['member_id'] = $this->session->userdata('insert_id');
						$insert = $this->common_model->join_as_detail($this->data['post_data']);
						$this->session->set_userdata('college_insert_id', $insert);
						$this->data['college_insert_id'] = $this->session->userdata('college_insert_id');
						if(isset($insert) && $insert != '' && $this->input->post('college'))
						{
							$this->data['next'] = 'professional';					
						}
						else 
						{
							$this->data['next'] = 'academic';
						}
						$this->load->view('join_as_member_detail',$this->data);
					}
					else
					{
						$this->data['input_data'] = $this->input->post();
						$this->data['error'] = validation_errors('<div class="error"><samp class="big-error">*</samp>', '</div>');
						$this->load->view('join_as_member_detail',$this->data);
					}
			}
			if($this->input->post('part') == 'academic_pg')
			{
				$this->form_validation->set_rules('pg', $this->data['label']['pg'], 'trim|required');
				// Run the validation.
					if ($this->form_validation->run())
					{
						$this->session->set_userdata('member_data', $this->input->post());
						$this->data['post_data'] = $this->session->userdata('member_data');
						$this->data['post_data']['member_id'] = $this->session->userdata('insert_id');
						$insert = $this->common_model->join_as_detail($this->data['post_data']);
						$this->session->set_userdata('college_insert_id', $insert);
						$this->data['college_insert_id'] = $this->session->userdata('college_insert_id');
						if(isset($insert) && $insert != '' && $this->input->post('pg'))
						{
							$this->data['next'] = 'professional';					
						}
						else 
						{
							$this->data['next'] = 'academic';
						}
						$this->load->view('join_as_member_detail',$this->data);
					}
					else
					{
						$this->data['input_data'] = $this->input->post();
						$this->data['error'] = validation_errors('<div class="error"><samp class="big-error">*</samp>', '</div>');
						$this->load->view('join_as_member_detail',$this->data);
					}
			}
			if($this->input->post('part') == 'professional')
			{
				$this->form_validation->set_rules('current_employer', $this->data['label']['current_employer'], 'trim|required');
				// Run the validation.
					if ($this->form_validation->run())
					{
						$this->session->set_userdata('member_data', $this->input->post());
						$this->data['post_data'] = $this->session->userdata('member_data');
						$this->data['post_data']['member_id'] = $this->session->userdata('insert_id');
						$insert = $this->common_model->join_as_detail($this->data['post_data']);
						$this->session->set_userdata('employer_insert_id', $insert);
						$this->data['employer_insert_id'] = $this->session->userdata('employer_insert_id');
						if(isset($insert) && $insert != '' && $this->input->post('current_employer'))
						{
							$this->data['next'] = 'myinterest';					
						}
						else 
						{
							$this->data['next'] = 'professional';
						}
						$this->load->view('join_as_member_detail',$this->data);
					}
					else
					{
						$this->data['input_data'] = $this->input->post();
						$this->data['error'] = validation_errors('<div class="error"><samp class="big-error">*</samp>', '</div>');
						$this->load->view('join_as_member_detail',$this->data);
					}
			}
			if($this->input->post('part') == 'myinterest')
			{
				$this->form_validation->set_rules('my_hobbies', 'My Hobbies', 'trim|required');
				// Run the validation.
					if ($this->form_validation->run())
					{
						$this->session->set_userdata('member_data', $this->input->post());
						$this->data['post_data'] = $this->session->userdata('member_data');
						$this->data['post_data']['member_id'] = $this->session->userdata('insert_id');
						$insert = $this->common_model->join_as_detail($this->data['post_data']);
						$this->session->set_userdata('employer_insert_id', $insert);
						$this->data['employer_insert_id'] = $this->session->userdata('employer_insert_id');
						if(isset($insert) && $insert != '' && $this->input->post('my_hobbies'))
						{
							$this->data['post_message'] = $this->lang->line('activation_email_successful');
						}
						else 
						{
							$this->data['post_message'] = $this->lang->line('account_creation_unsuccessful');
						}
						$this->delete_session_data();
						$this->load->view('join_as_member_message',$this->data);
					}
					else
					{
						$this->data['input_data'] = $this->input->post();
						$this->data['error'] = validation_errors('<div class="error"><samp class="big-error">*</samp>', '</div>');
						$this->load->view('join_as_member_detail',$this->data);
					}
			}
			if($this->input->post('profile_image')=='profile image'){
				
					if($_FILES['userfile']['type']=='image/png'){
						$ext = '.png' ;
					}
					else if($_FILES['userfile']['type']=='image/jpeg' || $_FILES['userfile']['type']=='image/jpg'){
						$ext = '.jpg' ;
					}
					$this->load->helper(array('form','url'));
					$config['upload_path'] = 'uploads/member/personal';
					$config['allowed_types'] = 'jpg|jpeg|png';
					$config['overwrite'] = TRUE;
					$config['max_size']	= '1024';
					$config['file_name'] = "profile_image_".$this->session->userdata('insert_id');
					$this->load->library('upload',$config);
					//upload image
					//echo realpath(dirname('')); die();
					$upload_data = $this->upload->do_upload();
						//crop image
						$this->load->library('image_lib');
					//	var_dump(realpath(base_url())); die();
						$config2['source_image'] = realpath(dirname('')).'/uploads/member/personal/'.$config['file_name'].$ext;//base_url().$config['upload_path'].'/'.$config['file_name'].'.jpg';
						//var_dump($config2['source_image']); die();
						$config2['width']	= $_POST['x2'];
						$config2['height']	= $_POST['y2'];
						$config2['x_axis'] = $_POST['x1'];
						$config2['y_axis'] = $_POST['y1'];
						$config2['maintain_ratio'] = TRUE;
						$config2['create_thumb'] = FALSE;
						$this->image_lib->initialize($config2);
						if (!$this->image_lib->crop()) { 
							echo $this->image_lib->display_errors(); 
							die();
						}else {
							$image_path = base_url().$config['upload_path'].'/'.$config['file_name'].$ext;
							$image_source = base_url().$config['upload_path'];
							$image_name = $config['file_name'].$ext;
							$image_type = $_FILES['userfile']['type'];
							$image_fk = $this->input->post('profile_image');
							$insert = $this->common_model->upload_profile_image($image_source,$image_name,$image_type,$image_fk);
							$this->session->set_userdata('profile_image_path',$image_path);
						}
						$this->image_lib->clear();
						unset($config2);
						$this->data['next'] = 'academic';	
						$this->load->view('join_as_member_detail',$this->data);
					}
		}
    if($member_type == 'parent'){
		
			if($this->input->post('part') == 'personal'){
				$this->form_validation->set_rules('email', $this->data['label']['email'], 'trim|required|valid_email|is_unique[zrc_members.email]');
				$this->form_validation->set_rules('password', $this->data['label']['password'], 'trim|required');
				$this->form_validation->set_rules('first_name', $this->data['label']['first_name'], 'trim|required');
				$this->form_validation->set_rules('last_name', $this->data['label']['last_name'], 'trim|required');
				$this->form_validation->set_rules('state', $this->data['label']['state'], 'trim|required');
				$this->form_validation->set_rules('city', $this->data['label']['city'], 'trim|required');
				$this->form_validation->set_message('is_unique', 'You are already registered');
				// Run the validation.
					if ($this->form_validation->run())
					{
						$this->session->set_userdata('member_data', $this->input->post());
						$this->session->set_userdata('member_email', $this->input->post('email'));
						$this->data['input_data'] = $this->session->userdata('member_data');
						$insert = $this->common_model->join_as_detail($this->data['input_data']);
						$this->session->set_userdata('insert_id', $insert);
						$this->data['insert_id'] = $this->session->userdata('insert_id');
						
						if(isset($insert) && $insert != '' && $this->input->post('email'))
						{
							$this->data['next'] = 'academic';					
						}
						else 
						{
							$this->data['next'] = 'personal';
						}
						$this->session->set_userdata('submit', 'hide');
						$this->load->view('join_as_member_detail',$this->data);
					}
					else
					{
						$this->data['input_data'] = $this->input->post();
						$this->data['error'] = validation_errors('<div class="error"><samp class="big-error">*</samp>', '</div>');
						$this->load->view('join_as_member_detail',$this->data);
					}
			}
			if($this->input->post('part') == 'academic_school')
			{
				$this->form_validation->set_rules('school', $this->data['label']['school'], 'trim|required');
				$this->form_validation->set_rules('class', $this->data['label']['class'], 'trim|required');
				$this->form_validation->set_rules('section', $this->data['label']['section'], 'trim|required');
				// Run the validation.
					if ($this->form_validation->run())
					{
						$this->session->set_userdata('member_data', $this->input->post());
						$this->data['input_data1'] = $this->input->post();
						$this->data['post_data'] = $this->session->userdata('member_data');
						$this->data['post_data']['member_id'] = $this->session->userdata('insert_id');
						$insert = $this->common_model->join_as_detail($this->data['post_data']);
						$this->session->set_userdata('school_insert_id', $insert);
						$this->data['school_insert_id'] = $this->session->userdata('school_insert_id');
						if(isset($insert) && $insert != '' && $this->input->post('school'))
						{
							$this->data['next'] = 'academic';					
						}
						else 
						{
							$this->data['next'] = 'academic';
						}
						$this->load->view('join_as_member_detail',$this->data);
					}
					else
					{
						//var_dump('fail'); die();
						$this->data['input_data1'] = $this->input->post();
						$this->data['error'] = validation_errors('<div class="error"><samp class="big-error">*</samp>', '</div>');
						$this->load->view('join_as_member_detail',$this->data);
					}
			}
			if($this->input->post('part') == 'academic_college')
			{
				$this->form_validation->set_rules('college', $this->data['label']['college'], 'trim|required');
				$this->form_validation->set_rules('course_name', $this->data['label']['course_name'], 'trim|required');
				// Run the validation.
					if ($this->form_validation->run())
					{
						$this->session->set_userdata('member_data', $this->input->post());
						$this->data['post_data'] = $this->session->userdata('member_data');
						$this->data['input_data2'] = $this->input->post();
						$this->data['post_data']['member_id'] = $this->session->userdata('insert_id');
						$insert = $this->common_model->join_as_detail($this->data['post_data']);
						$this->session->set_userdata('college_insert_id', $insert);
						$this->data['college_insert_id'] = $this->session->userdata('college_insert_id');
						if(isset($insert) && $insert != '' && $this->input->post('college'))
						{
							$this->data['next'] = 'professional';					
						}
						else 
						{
							$this->data['next'] = 'academic';
						}
						$this->load->view('join_as_member_detail',$this->data);
					}
					else
					{
						$this->data['input_data2'] = $this->input->post();
						$this->data['error'] = validation_errors('<div class="error"><samp class="big-error">*</samp>', '</div>');
						$this->load->view('join_as_member_detail',$this->data);
					}
			}
			if($this->input->post('part') == 'academic_pg')
			{
				$this->form_validation->set_rules('pg', $this->data['label']['pg'], 'trim|required');
				// Run the validation.
					if ($this->form_validation->run())
					{
						$this->session->set_userdata('member_data', $this->input->post());
						$this->data['post_data'] = $this->session->userdata('member_data');
						$this->data['post_data']['member_id'] = $this->session->userdata('insert_id');
						$this->data['input_data3'] = $this->input->post();
						$insert = $this->common_model->join_as_detail($this->data['post_data']);
						$this->session->set_userdata('college_insert_id', $insert);
						$this->data['college_insert_id'] = $this->session->userdata('college_insert_id');
						if(isset($insert) && $insert != '' && $this->input->post('pg'))
						{
							$this->data['next'] = 'professional';					
						}
						else 
						{
							$this->data['next'] = 'academic';
						}
						$this->load->view('join_as_member_detail',$this->data);
					}
					else
					{
						$this->data['input_data'] = $this->input->post();
						$this->data['error'] = validation_errors('<div class="error"><samp class="big-error">*</samp>', '</div>');
						$this->load->view('join_as_member_detail',$this->data);
					}
			}
			if($this->input->post('part') == 'professional')
			{
				$this->form_validation->set_rules('current_employer', $this->data['label']['current_employer'], 'trim|required');
				// Run the validation.
					if ($this->form_validation->run())
					{
						$this->session->set_userdata('member_data', $this->input->post());
						$this->data['post_data'] = $this->session->userdata('member_data');
						$this->data['input_data4'] = $this->input->post();
						$this->data['post_data']['member_id'] = $this->session->userdata('insert_id');
						$insert = $this->common_model->join_as_detail($this->data['post_data']);
						$this->session->set_userdata('employer_insert_id', $insert);
						$this->data['employer_insert_id'] = $this->session->userdata('employer_insert_id');
						if(isset($insert) && $insert != '' && $this->input->post('current_employer'))
						{
							$this->data['next'] = 'myinterest';					
						}
						else 
						{
							$this->data['next'] = 'professional';
						}
						$this->load->view('join_as_member_detail',$this->data);
					}
					else
					{
						$this->data['input_data4'] = $this->input->post();
						$this->data['error'] = validation_errors('<div class="error"><samp class="big-error">*</samp>', '</div>');
						$this->load->view('join_as_member_detail',$this->data);
					}
			}
			if($this->input->post('part') == 'myinterest')
			{
				$this->form_validation->set_rules('my_hobbies', 'My Hobbies', 'trim|required');
				// Run the validation.
					if ($this->form_validation->run())
					{
						$this->session->set_userdata('member_data', $this->input->post());
						$this->data['post_data'] = $this->session->userdata('member_data');
						$this->data['input_data5'] = $this->input->post();
						$this->data['post_data']['member_id'] = $this->session->userdata('insert_id');
						$insert = $this->common_model->join_as_detail($this->data['post_data']);
						$this->session->set_userdata('employer_insert_id', $insert);
						$this->data['employer_insert_id'] = $this->session->userdata('employer_insert_id');
						if(isset($insert) && $insert != '' && $this->input->post('my_hobbies'))
						{
							$this->data['post_message'] = $this->lang->line('activation_email_successful');
						}
						else 
						{
							$this->data['post_message'] = $this->lang->line('account_creation_unsuccessful');
						}
						$this->delete_session_data();
						$this->load->view('join_as_member_message',$this->data);
					}
					else
					{
						$this->data['input_data5'] = $this->input->post();
						$this->data['error'] = validation_errors('<div class="error"><samp class="big-error">*</samp>', '</div>');
						$this->load->view('join_as_member_detail',$this->data);
					}
			}
			if($this->input->post('profile_image')=='profile image'){
				
					if($_FILES['userfile']['type']=='image/png'){
						$ext = '.png' ;
					}
					else if($_FILES['userfile']['type']=='image/jpeg' || $_FILES['userfile']['type']=='image/jpg'){
						$ext = '.jpg' ;
					}
					$this->load->helper(array('form','url'));
					$config['upload_path'] = 'uploads/member/personal';
					$config['allowed_types'] = 'jpg|jpeg|png';
					$config['overwrite'] = TRUE;
					$config['max_size']	= '1024';
					$config['file_name'] = "profile_image_".$this->session->userdata('insert_id');
					$this->load->library('upload',$config);
					//upload image
					$upload_data = $this->upload->do_upload();
						//crop image
						$this->load->library('image_lib');
						
						$config2['source_image'] = realpath(dirname('')).'/uploads/member/personal/'.$config['file_name'].$ext;//base_url().$config['upload_path'].'/'.$config['file_name'].'.jpg';						$config2['width']	= $_POST['x2'];
						$config2['height']	= $_POST['y2'];
						$config2['x_axis'] = $_POST['x1'];
						$config2['y_axis'] = $_POST['y1'];
						$config2['maintain_ratio'] = TRUE;
						$config2['create_thumb'] = FALSE;
						$this->image_lib->initialize($config2);
						if (!$this->image_lib->crop()) { 
							echo $this->image_lib->display_errors(); 
							die();
						}else {
							$image_path = base_url().$config['upload_path'].'/'.$config['file_name'].$ext;
							$image_source = base_url().$config['upload_path'];
							$image_name = $config['file_name'].$ext;
							$image_type = $_FILES['userfile']['type'];
							$image_fk = $this->input->post('profile_image');
							$insert = $this->common_model->upload_profile_image($image_source,$image_name,$image_type,$image_fk);
							$this->session->set_userdata('profile_image_path',$image_path);
						}
						$this->image_lib->clear();
						unset($config2);
						$this->data['next'] = 'academic';	
						$this->load->view('join_as_member_detail',$this->data);
					}
			
		}
		if($member_type == 'teacher'){
		//	var_dump($this->input->post()); die();
			if($this->input->post('part') == 'personal')
			{
				$this->form_validation->set_rules('email', $this->data['label']['email'], 'trim|required|valid_email|is_unique[zrc_members.email]');
				$this->form_validation->set_rules('password', $this->data['label']['password'], 'trim|required');
				$this->form_validation->set_rules('first_name', $this->data['label']['first_name'], 'trim|required');
				$this->form_validation->set_rules('last_name', $this->data['label']['last_name'], 'trim|required');
				$this->form_validation->set_rules('state', $this->data['label']['state'], 'trim|required');
				$this->form_validation->set_rules('city', $this->data['label']['city'], 'trim|required');
				$this->form_validation->set_message('is_unique', 'You are already registered');
				// Run the validation.
					if ($this->form_validation->run())
					{
						$this->session->set_userdata('member_data', $this->input->post());
						$this->session->set_userdata('member_email', $this->input->post('email'));
						$this->data['input_data'] = $this->session->userdata('member_data');
						$insert = $this->common_model->join_as_detail($this->data['input_data']);
						$this->session->set_userdata('insert_id', $insert);
						$this->data['insert_id'] = $this->session->userdata('insert_id');
						if(isset($insert) && $insert != '' && $this->input->post('email'))
						{
							$this->data['next'] = 'academic';					
						}
						else 
						{
							$this->data['next'] = 'personal';
						}
						$this->session->set_userdata('submit', 'hide');
						$this->load->view('join_as_member_detail',$this->data);
					}
					else
					{
						$this->data['input_data'] = $this->input->post();
						$this->data['error'] = validation_errors('<div class="error"><samp class="big-error">*</samp>', '</div>');
						$this->load->view('join_as_member_detail',$this->data);
					}
			}
			if($this->input->post('part') == 'academic_school')
			{
				//var_dump($this->input->post()); die();
				$this->form_validation->set_rules('school', $this->data['label']['school'], 'trim|required');
				$this->form_validation->set_rules('class', $this->data['label']['class'], 'trim|required');
				$this->form_validation->set_rules('section', $this->data['label']['section'], 'trim|required');
				
				// Run the validation.
					if ($this->form_validation->run())
					{
						$this->session->set_userdata('member_data', $this->input->post());
						$this->data['post_data'] = $this->session->userdata('member_data');
						$this->data['input_data1'] = $this->input->post();
						$this->data['post_data']['member_id'] = $this->session->userdata('insert_id');
						$insert = $this->common_model->join_as_detail($this->data['post_data']);
						$this->session->set_userdata('school_insert_id', $insert);
						$this->data['school_insert_id'] = $this->session->userdata('school_insert_id');
						if(isset($insert) && $insert != '' && $this->input->post('school'))
						{
							$this->data['next'] = 'academic';					
						}
						else 
						{
							$this->data['next'] = 'academic';
						}
						$this->load->view('join_as_member_detail',$this->data);
					}
					else
					{
						$this->data['input_data1'] = $this->input->post();
						$this->data['error'] = validation_errors('<div class="error"><samp class="big-error">*</samp>', '</div>');
						$this->load->view('join_as_member_detail',$this->data);
					}
			}
			if($this->input->post('part') == 'academic_college')
			{
				$this->form_validation->set_rules('college', $this->data['label']['college'], 'trim|required');
				$this->form_validation->set_rules('course_name', $this->data['label']['course_name'], 'trim|required');
				// Run the validation.
					if ($this->form_validation->run())
					{
						$this->session->set_userdata('member_data', $this->input->post());
						$this->data['input_data2'] = $this->input->post();
						$this->data['post_data'] = $this->session->userdata('member_data');
						$this->data['post_data']['member_id'] = $this->session->userdata('insert_id');
						$insert = $this->common_model->join_as_detail($this->data['post_data']);
						$this->session->set_userdata('college_insert_id', $insert);
						$this->data['college_insert_id'] = $this->session->userdata('college_insert_id');
						if(isset($insert) && $insert != '' && $this->input->post('college'))
						{
							$this->data['next'] = 'professional';					
						}
						else 
						{
							$this->data['next'] = 'academic';
						}
						$this->load->view('join_as_member_detail',$this->data);
					}
					else
					{
						$this->data['input_data2'] = $this->input->post();
						$this->data['error'] = validation_errors('<div class="error"><samp class="big-error">*</samp>', '</div>');
						$this->load->view('join_as_member_detail',$this->data);
					}
			}
			if($this->input->post('part') == 'academic_pg')
			{
				$this->form_validation->set_rules('pg', $this->data['label']['pg'], 'trim|required');
				// Run the validation.
					if ($this->form_validation->run())
					{
						$this->session->set_userdata('member_data', $this->input->post());
						$this->data['input_data3'] = $this->input->post();
						$this->data['post_data'] = $this->session->userdata('member_data');
						$this->data['post_data']['member_id'] = $this->session->userdata('insert_id');
						$insert = $this->common_model->join_as_detail($this->data['post_data']);
						$this->session->set_userdata('college_insert_id', $insert);
						$this->data['college_insert_id'] = $this->session->userdata('college_insert_id');
						if(isset($insert) && $insert != '' && $this->input->post('pg'))
						{
							$this->data['next'] = 'professional';					
						}
						else 
						{
							$this->data['next'] = 'academic';
						}
						$this->load->view('join_as_member_detail',$this->data);
					}
					else
					{
						$this->data['input_data3'] = $this->input->post();
						$this->data['error'] = validation_errors('<div class="error"><samp class="big-error">*</samp>', '</div>');
						$this->load->view('join_as_member_detail',$this->data);
					}
			}
			if($this->input->post('part') == 'professional')
			{
				$this->form_validation->set_rules('current_employer', $this->data['label']['current_employer'], 'trim|required');
				// Run the validation.
					if ($this->form_validation->run())
					{
						$this->session->set_userdata('member_data', $this->input->post());
						$this->data['input_data4'] = $this->input->post();
						$this->data['post_data'] = $this->session->userdata('member_data');
						$this->data['post_data']['member_id'] = $this->session->userdata('insert_id');
						$insert = $this->common_model->join_as_detail($this->data['post_data']);
						$this->session->set_userdata('employer_insert_id', $insert);
						$this->data['employer_insert_id'] = $this->session->userdata('employer_insert_id');
						if(isset($insert) && $insert != '' && $this->input->post('current_employer'))
						{
							$this->data['next'] = 'myinterest';					
						}
						else 
						{
							$this->data['next'] = 'professional';
						}
						$this->load->view('join_as_member_detail',$this->data);
					}
					else
					{
						$this->data['input_data4'] = $this->input->post();
						$this->data['error'] = validation_errors('<div class="error"><samp class="big-error">*</samp>', '</div>');
						$this->load->view('join_as_member_detail',$this->data);
					}
			}
			if($this->input->post('part') == 'myinterest')
			{
				$this->form_validation->set_rules('my_hobbies', 'My Hobbies', 'trim|required');
				// Run the validation.
					if ($this->form_validation->run())
					{
						$this->session->set_userdata('member_data', $this->input->post());
						$this->data['input_data5'] = $this->input->post();
						$this->data['post_data'] = $this->session->userdata('member_data');
						$this->data['post_data']['member_id'] = $this->session->userdata('insert_id');
						$insert = $this->common_model->join_as_detail($this->data['post_data']);
						$this->session->set_userdata('employer_insert_id', $insert);
						$this->data['employer_insert_id'] = $this->session->userdata('employer_insert_id');
						if(isset($insert) && $insert != '' && $this->input->post('my_hobbies'))
						{
							$this->data['post_message'] = $this->lang->line('activation_email_successful');
						}
						else 
						{
							$this->data['post_message'] = $this->lang->line('account_creation_unsuccessful');
						}
						$this->delete_session_data();
						$this->load->view('join_as_member_message',$this->data);
					}
					else
					{
						$this->data['input_data5'] = $this->input->post();
						$this->data['error'] = validation_errors('<div class="error"><samp class="big-error">*</samp>', '</div>');
						$this->load->view('join_as_member_detail',$this->data);
					}
			}
			if($this->input->post('profile_image')=='profile image'){
				
					if($_FILES['userfile']['type']=='image/png'){
						$ext = '.png' ;
					}
					else if($_FILES['userfile']['type']=='image/jpeg' || $_FILES['userfile']['type']=='image/jpg'){
						$ext = '.jpg' ;
					}
					$this->load->helper(array('form','url'));
					$config['upload_path'] = 'uploads/member/personal';
					$config['allowed_types'] = 'jpg|jpeg|png';
					$config['overwrite'] = TRUE;
					$config['max_size']	= '1024';
					$config['file_name'] = "profile_image_".$this->session->userdata('insert_id');
					$this->load->library('upload',$config);
					//upload image
					$upload_data = $this->upload->do_upload();
						//crop image
						$this->load->library('image_lib');
						
						$config2['source_image'] = realpath(dirname('')).'/uploads/member/personal/'.$config['file_name'].$ext;//base_url().$config['upload_path'].'/'.$config['file_name'].'.jpg';						$config2['width']	= $_POST['x2'];
						$config2['height']	= $_POST['y2'];
						$config2['x_axis'] = $_POST['x1'];
						$config2['y_axis'] = $_POST['y1'];
						$config2['maintain_ratio'] = TRUE;
						$config2['create_thumb'] = FALSE;
						$this->image_lib->initialize($config2);
						if (!$this->image_lib->crop()) { 
							echo $this->image_lib->display_errors(); 
							die();
						}else {
							$image_path = base_url().$config['upload_path'].'/'.$config['file_name'].$ext;
							$image_source = base_url().$config['upload_path'];
							$image_name = $config['file_name'].$ext;
							$image_type = $_FILES['userfile']['type'];
							$image_fk = $this->input->post('profile_image');
							$insert = $this->common_model->upload_profile_image($image_source,$image_name,$image_type,$image_fk);
							$this->session->set_userdata('profile_image_path',$image_path);
						}
						$this->image_lib->clear();
						unset($config2);
						$this->data['next'] = 'academic';	
						$this->load->view('join_as_member_detail',$this->data);
					}
		}
		if($member_type == 'educator'){
			
			if($this->input->post('part') == 'personal')
			{
				$this->form_validation->set_rules('email', $this->data['label']['email'], 'trim|required|valid_email|is_unique[zrc_members.email]');
				$this->form_validation->set_rules('password', $this->data['label']['password'], 'trim|required');
				$this->form_validation->set_rules('first_name', $this->data['label']['first_name'], 'trim|required');
				$this->form_validation->set_rules('last_name', $this->data['label']['last_name'], 'trim|required');
				$this->form_validation->set_rules('state', 'state', 'trim|required');
				$this->form_validation->set_rules('city', 'city', 'trim|required');
				$this->form_validation->set_message('is_unique', 'You are already registered');
				// Run the validation.
					if ($this->form_validation->run())
					{
						$this->session->set_userdata('member_data', $this->input->post());
						$this->session->set_userdata('member_email', $this->input->post('email'));
						$this->data['input_data'] = $this->session->userdata('member_data');
						$insert = $this->common_model->join_as_detail($this->data['input_data']);
						$this->session->set_userdata('insert_id', $insert);
						$this->data['insert_id'] = $this->session->userdata('insert_id');
						if(isset($insert) && $insert != '' && $this->input->post('email'))
						{
							$this->data['next'] = 'academic';					
						}
						else 
						{
							$this->data['next'] = 'personal';
						}
						$this->session->set_userdata('submit', 'hide');
						$this->load->view('join_as_member_detail',$this->data);
					}
					else
					{
						$this->data['input_data'] = $this->input->post();
						$this->data['error'] = validation_errors('<div class="error"><samp class="big-error">*</samp>', '</div>');
						$this->load->view('join_as_member_detail',$this->data);
					}
			}
			if($this->input->post('part') == 'academic_school')
			{
				$this->form_validation->set_rules('school', $this->data['label']['school'], 'trim|required');
				$this->form_validation->set_rules('class', $this->data['label']['class'], 'trim|required');
				// Run the validation.
					if ($this->form_validation->run())
					{
						$this->session->set_userdata('member_data', $this->input->post());
						$this->data['input_data1'] = $this->input->post();
						$this->data['post_data'] = $this->session->userdata('member_data');
						$this->data['post_data']['member_id'] = $this->session->userdata('insert_id');
						$insert = $this->common_model->join_as_detail($this->data['post_data']);
						$this->data['input_data1'] = $this->input->post();
						$this->session->set_userdata('school_insert_id', $insert);
						$this->data['school_insert_id'] = $this->session->userdata('school_insert_id');
						if(isset($insert) && $insert != '' && $this->input->post('school'))
						{
							$this->data['next'] = 'professional';					
						}
						else 
						{
							$this->data['next'] = 'academic';
						}
						$this->load->view('join_as_member_detail',$this->data);
					}
					else
					{
						$this->data['input_data1'] = $this->input->post();
						$this->data['error'] = validation_errors('<div class="error"><samp class="big-error">*</samp>', '</div>');
						$this->load->view('join_as_member_detail',$this->data);
					}
			}
			if($this->input->post('part') == 'academic_college')
			{
				$this->form_validation->set_rules('college', $this->data['label']['college'], 'trim|required');
				$this->form_validation->set_rules('course_name', $this->data['label']['course_name'], 'trim|required');
				// Run the validation.
					if ($this->form_validation->run())
					{
						$this->session->set_userdata('member_data', $this->input->post());
						$this->data['input_data2'] = $this->input->post();
						$this->data['post_data'] = $this->session->userdata('member_data');
						$this->data['post_data']['member_id'] = $this->session->userdata('insert_id');
						$insert = $this->common_model->join_as_detail($this->data['post_data']);
						$this->session->set_userdata('college_insert_id', $insert);
						$this->data['college_insert_id'] = $this->session->userdata('college_insert_id');
						$this->data['input_data2'] = $this->input->post();
						if(isset($insert) && $insert != '' && $this->input->post('college'))
						{
							$this->data['next'] = 'professional';					
						}
						else 
						{
							$this->data['next'] = 'academic';
						}
						$this->load->view('join_as_member_detail',$this->data);
					}
					else
					{
						$this->data['input_data2'] = $this->input->post();
						$this->data['error'] = validation_errors('<div class="error"><samp class="big-error">*</samp>', '</div>');
						$this->load->view('join_as_member_detail',$this->data);
					}
			}
			if($this->input->post('part') == 'academic_pg')
			{
				$this->form_validation->set_rules('pg', $this->data['label']['pg'], 'trim|required');
				// Run the validation.
					if ($this->form_validation->run())
					{
						$this->session->set_userdata('member_data', $this->input->post());
						$this->data['input_data3'] = $this->input->post();
						$this->data['post_data'] = $this->session->userdata('member_data');
						$this->data['post_data']['member_id'] = $this->session->userdata('insert_id');
						$insert = $this->common_model->join_as_detail($this->data['post_data']);
						$this->session->set_userdata('college_insert_id', $insert);
						$this->data['college_insert_id'] = $this->session->userdata('college_insert_id');
						if(isset($insert) && $insert != '' && $this->input->post('pg'))
						{
							$this->data['next'] = 'professional';					
						}
						else 
						{
							$this->data['next'] = 'academic';
						}
						$this->load->view('join_as_member_detail',$this->data);
					}
					else
					{
						$this->data['input_data3'] = $this->input->post();
						$this->data['error'] = validation_errors('<div class="error"><samp class="big-error">*</samp>', '</div>');
						$this->load->view('join_as_member_detail',$this->data);
					}
			}
			if($this->input->post('part') == 'professional')
			{
				$this->form_validation->set_rules('current_employer', $this->data['label']['current_employer'], 'trim|required');
				// Run the validation.
					if ($this->form_validation->run())
					{
						$this->session->set_userdata('member_data', $this->input->post());
						$this->data['input_data4'] = $this->input->post();
						$this->data['post_data'] = $this->session->userdata('member_data');
						$this->data['post_data']['member_id'] = $this->session->userdata('insert_id');
						$insert = $this->common_model->join_as_detail($this->data['post_data']);
						$this->session->set_userdata('employer_insert_id', $insert);
						$this->data['employer_insert_id'] = $this->session->userdata('employer_insert_id');
						if(isset($insert) && $insert != '' && $this->input->post('current_employer'))
						{
							$this->data['next'] = 'myinterest';					
						}
						else 
						{
							$this->data['next'] = 'professional';
						}
						$this->load->view('join_as_member_detail',$this->data);
					}
					else
					{
						$this->data['input_data4'] = $this->input->post();
						$this->data['error'] = validation_errors('<div class="error"><samp class="big-error">*</samp>', '</div>');
						$this->load->view('join_as_member_detail',$this->data);
					}
			}
			if($this->input->post('part') == 'myinterest')
			{
				$this->form_validation->set_rules('my_hobbies', 'My Hobbies', 'trim|required');
				// Run the validation.
					if ($this->form_validation->run())
					{
						$this->session->set_userdata('member_data', $this->input->post());
						$this->data['input_data5'] = $this->input->post();
						$this->data['post_data'] = $this->session->userdata('member_data');
						$this->data['post_data']['member_id'] = $this->session->userdata('insert_id');
						$insert = $this->common_model->join_as_detail($this->data['post_data']);
						$this->session->set_userdata('employer_insert_id', $insert);
						$this->data['employer_insert_id'] = $this->session->userdata('employer_insert_id');
						if(isset($insert) && $insert != '' && $this->input->post('my_hobbies'))
						{
							$this->data['post_message'] = $this->lang->line('activation_email_successful');
						}
						else 
						{
							$this->data['post_message'] = $this->lang->line('account_creation_unsuccessful');
						}
						$this->delete_session_data();
						$this->load->view('join_as_member_message',$this->data);
					}
					else
					{
						$this->data['input_data5'] = $this->input->post();
						$this->data['error'] = validation_errors('<div class="error"><samp class="big-error">*</samp>', '</div>');
						$this->load->view('join_as_member_detail',$this->data);
					}
			}
			if($this->input->post('profile_image')=='profile image'){
				
					if($_FILES['userfile']['type']=='image/png'){
						$ext = '.png' ;
					}
					else if($_FILES['userfile']['type']=='image/jpeg' || $_FILES['userfile']['type']=='image/jpg'){
						$ext = '.jpg' ;
					}
					$this->load->helper(array('form','url'));
					$config['upload_path'] = 'uploads/member/personal';
					$config['allowed_types'] = 'jpg|jpeg|png';
					$config['overwrite'] = TRUE;
					$config['max_size']	= '1024';
					$config['file_name'] = "profile_image_".$this->session->userdata('insert_id');
					$this->load->library('upload',$config);
					//upload image
					$upload_data = $this->upload->do_upload();
						//crop image
						$this->load->library('image_lib');
						
						$config2['source_image'] = realpath(dirname('')).'/uploads/member/personal/'.$config['file_name'].$ext;//base_url().$config['upload_path'].'/'.$config['file_name'].'.jpg';						$config2['width']	= $_POST['x2'];
						$config2['height']	= $_POST['y2'];
						$config2['x_axis'] = $_POST['x1'];
						$config2['y_axis'] = $_POST['y1'];
						$config2['maintain_ratio'] = TRUE;
						$config2['create_thumb'] = FALSE;
						$this->image_lib->initialize($config2);
						if (!$this->image_lib->crop()) { 
							echo $this->image_lib->display_errors(); 
							die();
						}else {
							$image_path = base_url().$config['upload_path'].'/'.$config['file_name'].$ext;
							$image_source = base_url().$config['upload_path'];
							$image_name = $config['file_name'].$ext;
							$image_type = $_FILES['userfile']['type'];
							$image_fk = $this->input->post('profile_image');
							$insert = $this->common_model->upload_profile_image($image_source,$image_name,$image_type,$image_fk);
							$this->session->set_userdata('profile_image_path',$image_path);
						}
						$this->image_lib->clear();
						unset($config2);
						$this->data['next'] = 'academic';	
						$this->load->view('join_as_member_detail',$this->data);
					}
		}
		
		if($member_type == 'institute'){
			$institution_type = $this->input->post('institution_type');
			if($institution_type == 'school'){
				
				$this->form_validation->set_rules('email', $this->data['label']['email'], 'trim|required|is_unique[zrc_members.email]');
				$this->form_validation->set_rules('password', $this->data['label']['password'], 'trim|required');
				$this->form_validation->set_rules('first_name', $this->data['label']['first_name'], 'trim|required');
				$this->form_validation->set_rules('city', $this->data['label']['city'], 'trim|required');
				$this->form_validation->set_rules('state', $this->data['label']['state'], 'trim|required');
				$this->form_validation->set_message('is_unique', 'You are already registered');
				if ($this->form_validation->run()){
					$this->data['post_data'] = $this->input->post();
					if($this->common_model->join_as_detail($this->data['post_data'])){
							$this->data['post_message'] = $this->lang->line('activation_email_successful');
					}
					else 
					{
						$this->data['post_message'] = $this->lang->line('account_creation_unsuccessful');
					}
					$this->delete_session_data();
					$this->load->view('join_as_member_message',$this->data);
				}
				else {
					$this->data['input_data'] = $this->input->post();
					$this->data['error'] = validation_errors('<div class="error"><samp class="big-error">*</samp>', '</div>');
					$this->load->view('join_as_member_detail',$this->data);
				}
			}
			if($institution_type == 'college'){
				$this->form_validation->set_rules('email', $this->data['label']['email'], 'trim|required|is_unique[zrc_members.email]');
				$this->form_validation->set_rules('password', $this->data['label']['password'], 'trim|required');
				$this->form_validation->set_rules('first_name', $this->data['label']['first_name'], 'trim|required');
				$this->form_validation->set_rules('city', $this->data['label']['city'], 'trim|required');
				$this->form_validation->set_rules('state', $this->data['label']['state'], 'trim|required');
				$this->form_validation->set_message('is_unique', 'You are already registered');
				if ($this->form_validation->run()){
					$this->data['post_data'] = $this->input->post();
					if($this->common_model->join_as_detail($this->data['post_data'])){
							$this->data['post_message'] = $this->lang->line('activation_email_successful');
					}
					else 
					{
						$this->data['post_message'] = $this->lang->line('account_creation_unsuccessful');
					}
					$this->delete_session_data();
					$this->load->view('join_as_member_message',$this->data);
				}
				else {
					$this->data['input_data'] = $this->input->post();
					$this->data['current_div'] = 'college'; 
					$this->data['error'] = validation_errors('<div class="error"><samp class="big-error">*</samp>', '</div>');
					$this->load->view('join_as_member_detail',$this->data);
				}
			}
			if($institution_type == 'bussiness_entity'){
			
				$this->form_validation->set_rules('email', $this->data['label']['email'], 'trim|required|is_unique[zrc_members.email]');
				$this->form_validation->set_rules('password', $this->data['label']['password'], 'trim|required');
				$this->form_validation->set_rules('first_name', $this->data['label']['first_name'], 'trim|required');
				$this->form_validation->set_rules('city', $this->data['label']['city'], 'trim|required');
				$this->form_validation->set_rules('state', $this->data['label']['state'], 'trim|required');
				$this->form_validation->set_message('is_unique', 'You are already registered');
				if ($this->form_validation->run()){
					$this->data['post_data'] = $this->input->post();
					if($this->common_model->join_as_detail($this->data['post_data'])){
							$this->data['post_message'] = $this->lang->line('activation_email_successful');
					}
					else 
					{
						$this->data['post_message'] = $this->lang->line('account_creation_unsuccessful');
					}
					$this->delete_session_data();
					$this->load->view('join_as_member_message',$this->data);
				}
				else {
					$this->data['input_data'] = $this->input->post();
					$this->data['current_div'] = 'bussiness_entity'; 
					$this->data['error'] = validation_errors('<div class="error"><samp class="big-error">*</samp>', '</div>');
					$this->load->view('join_as_member_detail',$this->data);
				}
			}
		}
	}
	
	public function live($type)
	{	
		 $search = trim($this->input->post('search'));
		 $country = trim($this->input->post('country'));
		 $state_id =  trim($this->input->post('state'));
		 if(empty($search)) 
		 {
			 echo '';die;
		 }
		if($type == 'school'){
        	$this->data['schools'] = $this->common_model->school_list($search);
		}
		if($type == 'board'){
        	$this->data['schools'] = $this->common_model->board_list($search);
		}
		if($type == 'subject'){
        	$this->data['schools'] = $this->common_model->subject_list($search);
		}
		if($type == 'city'){
			if(isset($state_id) && $state_id!='' && $state_id!=NULL ){
				$this->data['schools'] = $this->common_model->city_list_state($search,$state_id);
			}else {
        		$this->data['schools'] = $this->common_model->city_list($search);
			}
		}
    	if($type == 'city1'){
			if(isset($state_id) && $state_id!='' && $state_id!=NULL){
				$this->data['schools'] = $this->common_model->city_list_state1($search,$state_id);
			}
		}
		if($type == 'city2'){
			if(isset($state_id) || $state_id!=''){
				$this->data['schools'] = $this->common_model->city_list_state2($search,$state_id);
			}
		}
		if($type == 'state'){
			if(isset($country) && $country!='' && $country==NULL){
				$this->data['schools'] = $this->common_model->state_list_country($search,$country);
			}else {
        		$this->data['schools'] = $this->common_model->state_list($search);
			}
		}
    	if($type == 'state1'){
			if(isset($country) || $country!=''){
				$this->data['schools'] = $this->common_model->state_list_country1($search,$country);
			}
		}
		if($type == 'state2'){
			if(isset($country) || $country!=''){
				$this->data['schools'] = $this->common_model->state_list_country2($search,$country);
			}
		}
		if($type == 'country'){
        	$this->data['schools'] = $this->common_model->country_list($search);
		}
		if($type == 'country1'){
        	$this->data['schools'] = $this->common_model->country_list1($search);
		}
		if($type == 'country2'){
        	$this->data['schools'] = $this->common_model->country_list2($search);
		}
		if($type == 'institute' || $type == 'college'){
        	$this->data['schools'] = $this->common_model->institute_list($search);
		}
		if($type == 'institute' || $type == 'PG'){
        	$this->data['schools'] = $this->common_model->pg_list($search);
		}
		if($type == 'book'){
        	$this->data['schools'] = $this->common_model->book_list($this->input->post());
		}
		if($type == 'chapter'){
        	$this->data['schools'] = $this->common_model->chapter_list($this->input->post());
		}
		echo $this->data['schools'];
	}
	
	public function check_mail()
	{
		$search = trim($this->input->post('search'));
		if(empty($search)) 
		{
			echo 'TRUE';
		}
        $this->data['result'] = $this->common_model->check_email($search);
		echo $this->data['result'];
	}

	public function about_us()
	{
		$this->data['title'] =$this->title.$this->data['page']['join_as']['title'];
		$this->config->set_item('sess_expire_on_close', FALSE); //'remember' is checkbox name.
		$this->data['value'] = 'about';
		$this->load->view('about_us', $this->data);
	}
	
	public function contact_us()
	{
		$this->data['title'] =$this->title.$this->data['page']['join_as']['title'];
		$this->config->set_item('sess_expire_on_close', FALSE); //'remember' is checkbox name.
		$this->data['value'] = 'contact';
		$this->load->view('about_us', $this->data);
	}
	public function team()
	{
		$this->data['title'] =$this->title.$this->data['page']['join_as']['title'];
		$this->config->set_item('sess_expire_on_close', FALSE); //'remember' is checkbox name.
		$this->data['value'] = 'team';
		$this->load->view('team', $this->data);
	}
	public function logout()
	{
		$this->session->sess_destroy();
		$this->data['title'] =$this->title.$this->data['page']['join_as']['title'];
		$this->config->set_item('sess_expire_on_close', FALSE); //'remember' is checkbox name.
		redirect('/');
	}
	public function validateRegex($input)
	{
		if (preg_match('/^[0-9a-zA-Z]+([0-9a-zA-Z]*[-._+])*[0-9a-zA-Z]+@[0-9a-zA-Z]+([-.][0-9a-zA-Z]+)*([0-9a-zA-Z]*[.])[a-zA-Z]{2,6}$/', $input))
		{
			return true; // it matched, return true or false if you want opposite
		}
		else
		{
		return false;
		}
	}
        public function resetPassword()
        {            
            $this->data['reset_email'] = base64_decode($_REQUEST['reset']);
            $this->data['reset_email'] = $this->security->xss_clean($this->data['reset_email']);

			if ($this->validateRegex($this->data['reset_email']))
			{
				$this->data['verify'] = $this->common_model->verify_email($this->data['reset_email']);
				if($this->data['verify'] != FALSE)
				{
					$this->load->view('reset_password',$this->data);
				}
				else
				{
					redirect(base_url().BASE.'join_in');
					exit();
				}
			}
			else
			{
				redirect(base_url().BASE.'join_in');
			    exit();
			}
        }
        
        public function confirmResetPassword()
        {
			$this->form_validation->set_rules('reset_email',$this->data['label']['email'],'trim|required|valid_email');
			$this->form_validation->set_rules('password', $this->data['label']['password'],'trim|required|matches[reconfirming_password]');
			$this->form_validation->set_rules('reconfirming_password', $this->data['label']['reconfirming_password'],'trim|required');
				// Run the validation.
				 if ($this->form_validation->run())
				{
				$reset_email = trim($this->input->post('reset_email'));
				$email_check = $this->common_model->check_email1($reset_email);
				$email_check = $email_check->num_rows();
				if($email_check >0)
					{
						$this->common_model->resetPassword($reset_email);
						redirect(base_url().BASE.'join_in');
						$this->delete_session_data();
					}
					else
					{
					$this->session->set_userdata('invalid_email','Email Address doesnot exist');
					redirect(base_url().BASE.'join_in');
					$this->delete_session_data();
					}
				}
				else
				{
				$this->data['input_data'] = $this->input->post();
				$this->data['error'] = validation_errors('<div class="error"><samp class="big-error">*</samp>', '</div>');
				$this->session->set_userdata('invalid_login','Password Do not match');
				redirect(BASE_URL.'reset_password', $this->data);
				}
        }
        
	public function accountActivate($value='')
	{
		$this->delete_session_data();
		$success = $this->common_model->activateAccount($value);
		if($success){
			$this->data['title'] =$this->title.$this->data['page']['join_in']['title'];
			$this->data['post_message'] = 'Thank you for activating your account';
			$this->data['refresh_page'] = '1';
			$this->load->view('join_as_member_message',$this->data);
		}
		else {
			redirect(base_url().BASE.'join_in');
		}
	}

	public function upload_profile_image(){
		//var_dump($_FILES['userfile']['type']); die();
		/*if($_FILES['userfile']['type']=='image/png'){
			$ext = '.png' ;
		}
		else if($_FILES['userfile']['type']=='image/jpeg' || $_FILES['userfile']['type']=='image/jpg'){
			$ext = '.jpg' ;
		}
		$this->load->helper(array('form','url'));
		$config['upload_path'] = 'uploads/member/personal';
		$config['allowed_types'] = 'jpg|jpeg|png';
		$config['overwrite'] = TRUE;
		$config['max_size']	= '1024';
		$config['file_name'] = "profile_image".$this->session->userdata('insert_id');
		$this->load->library('upload',$config);
		//upload image
		$upload_data = $this->upload->do_upload();
		//var_dump($upload_data); die();
			//crop image
			$this->load->library('image_lib');
			
			//C:\xampp\htdocs\zigya_backup/zigya_16march/zig1/uploads/member/personal
			$config2['source_image'] = 'C:/xampp/htdocs/zig1/uploads/member/personal/'.$config['file_name'].$ext;//base_url().$config['upload_path'].'/'.$config['file_name'].'.jpg';
			$config2['width']	= $_POST['x2'];
			$config2['height']	= $_POST['y2'];
			$config2['x_axis'] = $_POST['x1'];
			$config2['y_axis'] = $_POST['y1'];
			$config2['maintain_ratio'] = FALSE;
			$config2['create_thumb'] = FALSE;
			$this->image_lib->initialize($config2);
			if (!$this->image_lib->crop()) { 
				echo $this->image_lib->display_errors(); 
				die();
			}else {
				$this->session->set_userdata('profile_image_path',$config2['source_image']);
				//var_dump($this->session->userdata('profile_image_path'));die();
			}
			$this->image_lib->clear();
			unset($config2);
			var_dump($this->data); die();
			$this->load->view('join_as_member_detail',$this->data);*/
		//}
	}

	private function delete_session_data()
	{
	    if($this->session->userdata('member_data'))
	    {
		 $this->session->set_userdata('member_data',null);
	    }
		if($this->session->userdata('input_data'))
		{
		  $this->session->set_userdata('input_data',null);
		}
		if($this->session->userdata('member_detail_data'))
		{
		  $this->session->set_userdata('member_detail_data',null);
		}
	 }	
}
/* End of file home.php */
/* Location: ./application/controllers/home.php */